// 近N天
function getRecentDay(n) {
	var dd = new Date();
	dd.setDate(dd.getDate() - n); //获取n天前的日期
	var y = dd.getFullYear();
	var m = dd.getMonth() + 1; //获取当前月份的日期
	var d = dd.getDate();
	let day = y + '-' + m + '-' + d;
	return [day,getNowData()];
}
// 近N月
function getRecentMonth(n) {
	const datenow = new Date();
	const dateend =
		datenow.getFullYear().toString() +
		'-' +
		(datenow.getMonth() + 1).toString() +
		'-' +
		datenow.getDate().toString();
	datenow.setMonth(datenow.getMonth() - n);
	let dyear = datenow.getFullYear();
	let dmonth = datenow.getMonth() + 1;
	dmonth = dmonth < 10 ? 0 + dmonth : dmonth;
	let dday = datenow.getDate();
	const datestart =dyear.toString() + '-' + dmonth.toString() + '-' + dday.toString();
	return [datestart,dateend];
}
//获取当前日期
function getNowData(){
	var dd = new Date();
	var y = dd.getFullYear();
	var m = dd.getMonth() + 1; //获取当前月份的日期
	var d = dd.getDate();
	let day = y + '-' + m + '-' + d;
	return day
}
export default{
	getRecentDay,
	getRecentMonth
}